New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@patternfly/pfe-collapse

Package Overview
Dependencies
Maintainers
16
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@patternfly/pfe-collapse

Collapse element for PatternFly Elements

  • 2.0.0-next.4
  • next
  • npm
  • Socket score

Version published
Weekly downloads
25
decreased by-53.7%
Maintainers
16
Weekly downloads
 
Created
Source

PatternFly Elements Collapse

pfe-collapse, pfe-collapse-toggle, and pfe-collapse-panel are all elements that are meant to be extended. These elements contain no styling except for the animation styles for pfe-collapse-panel.

Read more about Collapse in the PatternFly Elements Collapse documentation

Installation

Load <pfe-collapse> via CDN:

<script src="https://unpkg.com/@patternfly/pfe-collapse?module"></script>

Or, if you are using NPM, install it

npm install @patternfly/pfe-collapse

Then once installed, import it to your application:

import '@patternfly/pfe-collapse';

Usage

pfe-collapse automatically wires up the toggle and panel so when the pfe-collapse-toggle is toggled, it will either open or close the pfe-collapse-panel.

<pfe-collapse>
  <pfe-collapse-toggle>
    This is the toggle
  </pfe-collapse-toggle>
  <pfe-collapse-panel>
    This is the panel
  </pfe-collapse-panel>
</pfe-collapse>

Collapse with a preset ID

<pfe-collapse>
  <pfe-collapse-toggle aria-controls="panel1">
    <h3>Collapse Toggle with preset ID</h3>
  </pfe-collapse-toggle>
  <pfe-collapse-panel id="panel1">
    <p>Panel content</p>
  </pfe-collapse-panel>
</pfe-collapse>

Standalone toggle and panel (not wrapped in a pfe-collapse)

The toggle needs an aria-controls attribute that links to the id of the panel.

<pfe-collapse-toggle aria-controls="panel">
  Toggle the Standalone Panel
</pfe-collapse-toggle>
<p>Other content:</p>
<pfe-collapse-panel id="panel">
  <p>Panel content</p>
</pfe-collapse-panel>

Standalone panel

A standalone panel can be opened by any action or event that toggles the expanded property on the panel.

<button>Toggle Panel</button>

<pfe-collapse-panel id="standalone-panel">
  <p>Panel content</p>
</pfe-collapse-panel>
const collapse = document.querySelector("#standalone-panel");
const button = document.querySelector("button");
button.addEventListener("click", => collapse.expanded = !collapse.expanded);

Keywords

FAQs

Package last updated on 25 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc